Safe Zero-cost Coercions for Haskell (extended version)

نویسندگان

  • Joachim Breitner
  • Richard A. Eisenberg
  • Simon Peyton Jones
  • Stephanie Weirich
چکیده

Generative type abstractions – present in Haskell, OCaml, and other languages – are useful concepts to help prevent programmer errors. They serve to create new types that are distinct at compile time but share a run-time representation with some base type. We present a new mechanism that allows for zero-cost conversions between generative type abstractions and their representations, even when such types are deeply nested. We prove type safety in the presence of these conversions and have implemented our work in GHC.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Safe Zero - cost Coercions for Haskell ( extended version ) 1

Generative type abstractions – present in Haskell, OCaml, and other languages – are useful concepts to help prevent programmer errors. They serve to create new types that are distinct at compile time but share a run-time representation with some base type. We present a new mechanism that allows for zero-cost conversions between generative type abstractions and their representations, even when s...

متن کامل

System FC with Explicit Kind Equality (extended version)

System FC, the core language of the Glasgow Haskell Compiler, is an explicitly-typed variant of System F with first-class type equality proofs called coercions. This extensible proof system forms the foundation for type system extensions such as type families (typelevel functions) and Generalized Algebraic Datatypes (GADTs). Such features, in conjunction with kind polymorphism and datatype prom...

متن کامل

Down with kinds: adding dependent heterogeneous equality to FC (Extended Version)

FC, the core language of the Glasgow Haskell Compiler, is an explicitly-typed variant of System F with first-class type equality proofs (i.e. coercions). This extensible proof system forms the foundation for type system extensions such as type families (typelevel functions) and Generalized Algebraic Datatypes (GADTs). Such features, especially in conjunction with kind polymorphism and datatype ...

متن کامل

Inferring Type Isomorphisms Generically

Datatypes which differ inessentially in their names and structure are said to be isomorphic; for example, a ternary product is isomorphic to a nested pair of binary products. In some canonical cases, the conversion function is uniquely determined solely by the two types involved. In this article we describe and implement a program in Generic Haskell which automatically infers this function by n...

متن کامل

Customizing an XML-Haskell data binding with type isomorphism inference in Generic Haskell

This paper introduces a type-preserving XML Schema–Haskell data binding (or, translation) UUXML, and shows how to customize it by exploiting the theory of canonical isomorphisms to automatically infer coercions between the machine-generated types and an equivalent, more natural, user-defined set of types. We show how to implement the inference mechanism in Generic Haskell.

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2016